#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QObject>
#include <QVector>
class Generate : public QObject
{
    Q_OBJECT
public:
    explicit Generate(QObject *parent = nullptr);
    void working(int num);
signals:
    void sendArray(QVector<int> num);
};

class BubbleSort : public QObject
{
    Q_OBJECT
public:
    explicit BubbleSort(QObject *parent = nullptr);
    void working(QVector<int> list);
signals:
    void finish(QVector<int> num);
};

class QuickSort : public QObject
{
    Q_OBJECT
public:
    explicit QuickSort(QObject *parent = nullptr);
    template<typename T>
    void swap(T& a, T& b) {
        T temp = a;
        a = b;
        b = temp;
    }
    void working(QVector<int> list);
signals:
    void finish(QVector<int> num);
private:
    void quicksort(QVector<int>& arr, int low, int high);
    int partition(QVector<int>& arr, int low, int high);
};

#endif // MYTHREAD_H
